1. Field of the Invention
This invention relates generally to disk drives, and more particularly to a magnetic recording disk drive having a cache that includes nonvolatile memory.
2. Description of the Related Art
Magnetic recording hard disk drives (HDDs) typically include, in addition to the rotating disk storage, solid state memory (referred to as “cache”) that temporarily holds data before it is transferred between the host computer and the disk storage. The conventional cache is dynamic random access memory (DRAM), a volatile form of memory that can undergo a significant number of write/erase cycles and that has a high data transfer rate.
The disk drive's data controller receives the write data from the host and controls the writing to the disks and the DRAM. The transfer of the write data to the DRAM is typically done using one of two conventional methods. In a first method, called “write-back caching”, the block of write data for a write command from the host is stored in DRAM, and write completion is signaled to the host when the block of write data has been received in the DRAM. The block of write data in DRAM is then later destaged from the DRAM and written to the disks. In a second method, sometimes called “write-through caching”, every write to DRAM also causes a write to the disks and write completion is signaled to the host only after the block of write data has been written to the disks.
With the advent of mobile computers that are battery powered, some HDDs have a “power-save” or “standby” mode wherein the disks spin down (stop rotating) when the drive has been inactive for a period of time. The main purpose of this mode is to extend the battery life of the mobile computer. When a disk drive is in standby mode, with just the electronics active, battery power is conserved. When write data is received from the host and must be written to the disks, the drive exits standby mode and the disks spin up to enable the write data to be written, which consumes a significant amount of battery power. If this occurs too frequently, there is no power saving.
One solution to this problem is to store the write data in the DRAM when the drive is in standby mode and the disks are not rotating, and then destage the write data to the disks at some later time, as in write-cache enabled. However, because DRAM is volatile memory, there is a risk that the write data in the DRAM can be lost if the drive loses power before the write data can be destaged to the disks. Thus it has been proposed to use nonvolatile memory, e.g., “flash” memory, in addition to or in place of DRAM in HDDs used in mobile computers, during the standby mode. The primary advantage is the ability to receive write data from the host without having to exit the standby mode, thereby conserving power and extending battery life, but without any risk of losing data in the event of a power failure.
The advantage of volatile memory like DRAM for caching is its speed, but it is relatively expensive and has high power consumption. As a consequence of the cost and power requirement, caches are usually relatively small. And as a consequence of the volatility, after a resume operation, the cache is empty and will generate a lot of cache misses before being fully operative. Also, at power-down, the cache must be flushed to ensure data integrity.
The access time (i.e., the time to read or write data) for nonvolatile memory, like flash memory, is considerably longer than the access time for DRAM. Also, flash memory, unlike DRAM, has a limited number of write/erase cycles before it is no longer usable. However, despite these disadvantages, flash memory is less expensive and uses less power than DRAM.
Thus in a HDD in which the nonvolatile memory is used for caching in standby mode, it would be desirable to also optimize the use of the nonvolatile memory together with the volatile memory for caching during normal non-standby operation as well as during standby operation of the HDD.